#  /**
#  * Copyright (c) 2022 Beijing Jiaotong University
#  * PhotLab is licensed under [Open Source License].
#  * You can use this software according to the terms and conditions of the [Open Source License].
#  * You may obtain a copy of [Open Source License] at: [https://open.source.license/]
#  *
#  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
#  * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
#  * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
#  *
#  * See the [Open Source License] for more details.
#  */
#  /**
#  * Author: Zheng Wang
#  * Created: Jun. 27, 2022
#  * Supported by: National Key Research and Development Program of China
#  */

def check_element_existence_in_list(elem, target_list):
    """
        To check an element if is in a list or not
    :param elem: to check element
    :param target_list: target list
    :return:
    """
    if elem in target_list:
        return True
    else:
        return False


def check_list_element_number_isvalid(ls, num):
    """
        check list max length is lower than number
    :param ls: a python list
    :param num: max size of the list
    :return:
    """
    if len(ls) <= num:
        return True
    else:
        return False


def check_all_list_length_is_same(max_length: int, *args) -> bool:
    """

    :param max_length: to check lists' max length
    :param args: [[],...,[]]
    :return: bool
    """
    for elem in args:
        if isinstance(elem, list):
            if len(elem) != max_length:
                return False
    return True
